fix(di): accept DeviceType subtypes during device discovery#4033
Merged
marcschier merged 1 commit intoJul 20, 2026
Merged
Conversation
marcschier
approved these changes
Jul 19, 2026
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4033 +/- ##
==========================================
- Coverage 73.85% 73.53% -0.33%
==========================================
Files 1345 1345
Lines 179988 180046 +58
Branches 31668 31678 +10
==========================================
- Hits 132938 132400 -538
- Misses 36299 36935 +636
+ Partials 10751 10711 -40
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes
DiDiscoveryClient.EnumerateDevicesAsync()acceptDeviceTypesubtypes instead of requiring an exact type-definition match and adds regression tests that verify derived device types are discovered while non-device objects remain filtered out.Problem
In OPC UA DI, device instances may be modeled directly as
DeviceTypeor as instances of any subtype derived fromDeviceType. A discovery helper that claims to enumerateDeviceTypedevices therefore needs to follow the OPC UA type hierarchy instead of requiring an exactTypeDefinitionmatch.Previously,
DiDiscoveryClient.BrowseForDevicesAsync()identified devices with a direct comparison againstDeviceType. As a result, any server that exposed devices through a legal subtype ofDeviceTypewould have those devices treated as non-device objects, causing them to be skipped or only used as recursion points instead of being returned as discovered devices.Changes
DeviceTypecomparison inBrowseForDevicesAsync()with a real subtype check based onsession.NodeCache.IsTypeOfAsync(...).DeviceTypeinstances still work, derived device types are now discovered, and non-device objects are still excluded.